package codeRandomThoughts.Test674最长连续递增序列;

//动态规划写法
public class Solution {
    public int findLengthOfLCIS(int[] nums) {
        //dp[i]:以nums[i]为结尾的最长且连续递增的子序列长度
        int[] dp = new int[nums.length];
        dp[0] = 1;

        for (int i = 1; i < nums.length; i++) {
            if (nums[i] > nums[i - 1]) {
                dp[i] = dp[i - 1] + 1;
            } else {
                dp[i] = 1;
            }
        }

        int maxLen = 0;
        for (int i = 0; i < dp.length; i++) {
            if (dp[i] > maxLen) {
                maxLen = dp[i];
            }
        }
        return maxLen;
    }
}
